package com.zhihaoliang.bezier.bezier

import android.util.Log
import android.widget.SeekBar
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 * @author 支豪亮
 * @date 2023/1/9 11:31
 * @des BezierActivity 的 ViewModle
 */
class BezierViewModle:ViewModel() {

    /**
     * SeekBar 的 progress，动画播放速率
     */
    private var _progress:MutableLiveData<Int> = MutableLiveData(5)

    /**
     * 动画执行的速度
     */
    val progress:MutableLiveData<Int> = _progress

    var isLoop:MutableLiveData<Boolean> = MutableLiveData(false)

    var isTangent:MutableLiveData<Boolean> = MutableLiveData(true)


    fun onProgressChanged(seekBar: SeekBar,  progress:Int,  fromUser:Boolean){
        if(fromUser) _progress.value = progress
        Log.e("onProgressChanged","$progress : $fromUser")
    }

}